/*
 * @Author: your name
 * @Date: 2020-09-21 08:05:06
 * @LastEditTime: 2020-11-19 14:38:35
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \longh_web\src\utils\auth.js
 */
// 设置全局信息  
import Cookies from 'js-cookie'


/* 
    TokenKey  用户唯一token标识
    UserinfoKey  用户信息
*/
const TokenKey = 'LHGYXT_WEB_TOKEN'
const UserinfoKey = 'LHGYXT_WEB_USERINFO'
const xxl_sso_sessionid = "xxl_sso_sessionid"
const redirect_url = "redirect_url"
const ShowProductKey = 'ShowProductDialog'
const IsSignKey = 'IsSign'



// 用户Token
export function getIsSign() {
    return Cookies.get(IsSignKey)
}

export function setIsSign(token) {
    return Cookies.set(IsSignKey, token)
}

export function removeIsSign() {
    return Cookies.remove(IsSignKey)
}


// 用户Token
export function getToken() {
    return Cookies.get(TokenKey)
}

export function setToken(token) {
    return Cookies.set(TokenKey, token)
}

export function removeToken() {
    return Cookies.remove(TokenKey)
}


// 用户信息
export function getCookiesUserInfo() {
    return Cookies.get(UserinfoKey)
}

export function setCookiesUserInfo(UserInfo) {
    return Cookies.set(UserinfoKey, UserInfo)
}

export function removeCookiesUserInfo() {
    return Cookies.remove(UserinfoKey)
}


export function setCookies(val) {
    return Cookies.set(xxl_sso_sessionid, val)
}


export function setredirect_url(val) {
    return Cookies.set(redirect_url, val)
}
export function removeCookies(val) {
    return Cookies.remove(xxl_sso_sessionid)
}

// 是否显示首页推荐弹窗
export function getShowProductDialog() {
    return Cookies.get(ShowProductKey)
}
export function setShowProductDialog(UserInfo) {
    return Cookies.set(ShowProductKey, UserInfo, { expires: 7 })
}
export function removeShowProductDialog() {
    return Cookies.remove(ShowProductKey)
}

